const conf = new (require('conf'))()
const chalk = require('chalk')
const TaskAPI = require('./../api/task')

async function markDone(taskId) {

  const id = conf.get("task:" + taskId);
  const taskAPI = new TaskAPI();
  if (id) {
    await taskAPI.delete(id);
    //show the user a message
    console.log(
      chalk.green.bold('Tasks have been marked as done successfully')
    )
  } else {
    console.log(
      chalk.red.bold('no error')
    )
  }

}

module.exports = markDone
